package com.example.evanproject.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.evanproject.domain.Excellent;
import com.example.evanproject.domain.News;
import com.example.evanproject.mapper.NewsMapper;
import com.example.evanproject.service.ExcellentService;
import com.example.evanproject.mapper.ExcellentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author hanxiaoqi
* @description 针对表【excellent】的数据库操作Service实现
* @createDate 2024-03-09 21:52:13
*/
@Service
public class ExcellentServiceImpl extends ServiceImpl<ExcellentMapper, Excellent>
    implements ExcellentService{


    @Autowired
    private ExcellentMapper excellentMapper;
    @Autowired
    private NewsMapper newMapper;


    //获取优选列表
    public List<News> selectgoodall(Integer fid){

        String str=excellentMapper.selectgoodall(fid);
        String[] arr={"0"};
        if(str!=null&&str!=""){
            arr= str.split(",");
        }

        return newMapper.selectbyids(arr);
    }

    //更改优选列表
    public  Integer updatedata(Integer fid, String[] str){
        String strlist=String.join(",", str);
        return excellentMapper.updatedate(fid,strlist);
    }
}




